Turn off input methods in invisible entries, since they are confusing.
authorMatthias Clasen <mclasen@redhat.com>
Fri, 18 Nov 2005 19:13:11 +0000 (19:13 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 18 Nov 2005 19:13:11 +0000 (19:13 +0000)
2005-11-18  Matthias Clasen  <mclasen@redhat.com>

Turn off input methods in invisible entries, since
they are confusing.  (#317002, James Su)

* gtk/gtkentry.c (gtk_entry_set_visibility): Toggle input
methods if visibility changes.
(popup_targets_received): Don't show the input method
menu if the entry is invisible.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkentry.c

index 100264926585d3e4a70fa28111dc76e2dada6bac..e8237acee405004c800fbc69187b145acf751404 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-11-18  Matthias Clasen  <mclasen@redhat.com>
+
+       Turn off input methods in invisible entries, since
+       they are confusing.  (#317002, James Su)
+       
+       * gtk/gtkentry.c (gtk_entry_set_visibility): Toggle input
+       methods if visibility changes.
+       (popup_targets_received): Don't show the input method
+       menu if the entry is invisible.  
+
 2005-11-17  Matthias Clasen  <mclasen@redhat.com>
 
        * README.in: Add a note about range arrow sensitivity.
index 100264926585d3e4a70fa28111dc76e2dada6bac..e8237acee405004c800fbc69187b145acf751404 100644 (file)
@@ -1,3 +1,13 @@
+2005-11-18  Matthias Clasen  <mclasen@redhat.com>
+
+       Turn off input methods in invisible entries, since
+       they are confusing.  (#317002, James Su)
+       
+       * gtk/gtkentry.c (gtk_entry_set_visibility): Toggle input
+       methods if visibility changes.
+       (popup_targets_received): Don't show the input method
+       menu if the entry is invisible.  
+
 2005-11-17  Matthias Clasen  <mclasen@redhat.com>
 
        * README.in: Add a note about range arrow sensitivity.
index 83cc9f409c506f6119215a12f84abdb740304f89..62611434287c80ad9fe478d2969ae11606537639 100644 (file)
@@ -3969,9 +3969,37 @@ gtk_entry_set_visibility (GtkEntry *entry,
 {
   g_return_if_fail (GTK_IS_ENTRY (entry));
 
-  entry->visible = visible ? TRUE : FALSE;
-  g_object_notify (G_OBJECT (entry), "visibility");
-  gtk_entry_recompute (entry);
+  visible = visible != FALSE;
+
+  if (entry->visible != visible)
+    {
+      if (GTK_WIDGET_HAS_FOCUS (entry) && !visible)
+       gtk_im_context_focus_out (entry->im_context);
+
+      g_object_unref (entry->im_context);
+
+      if (visible)
+        entry->im_context = gtk_im_multicontext_new ();
+      else
+        entry->im_context = gtk_im_context_simple_new ();
+      
+      g_signal_connect (entry->im_context, "commit",
+                       G_CALLBACK (gtk_entry_commit_cb), entry);
+      g_signal_connect (entry->im_context, "preedit_changed",
+                       G_CALLBACK (gtk_entry_preedit_changed_cb), entry);
+      g_signal_connect (entry->im_context, "retrieve_surrounding",
+                       G_CALLBACK (gtk_entry_retrieve_surrounding_cb), entry);
+      g_signal_connect (entry->im_context, "delete_surrounding",
+                       G_CALLBACK (gtk_entry_delete_surrounding_cb), entry);
+
+      if (GTK_WIDGET_HAS_FOCUS (entry) && visible)
+       gtk_im_context_focus_in (entry->im_context); 
+
+      entry->visible = visible;
+
+      g_object_notify (G_OBJECT (entry), "visibility");
+      gtk_entry_recompute (entry);
+    }
 }
 
 /**
@@ -4601,7 +4629,10 @@ popup_targets_received (GtkClipboard     *clipboard,
                     "gtk-show-input-method-menu", &show_input_method_menu,
                     "gtk-show-unicode-menu", &show_unicode_menu,
                     NULL);
-      
+
+      if (!entry->visible)
+        show_input_method_menu = FALSE;
+
       if (show_input_method_menu || show_unicode_menu)
         {
           menuitem = gtk_separator_menu_item_new ();